﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage/Admin.Master"
    CodeBehind="SearchResults.aspx.vb" Inherits="GoodAnotApp.SearchResults" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style2
        {
            width: 717px;
            height: 29px;
        }
        .style4
        {
            height: 117px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="SearchResult" style="top: 300px; margin-left: 10px; width: 945px;">
        <table style="width: 100%">
            <tr align="right" style="width: 100%">
                <td colspan="2" align="right" style="border-top: 0px">
                    <table width="100%" style="margin-bottom: 0px">
                        <tr>
                            <td class="sortByContainer" style="border-top: 0px" align="right">
                                <div align="right">
                                    <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sort by:</strong>&nbsp;
                                    <asp:LinkButton ID="lbSortDate" runat="server" ForeColor="#FF9933">Date </asp:LinkButton>
                                    &nbsp;
                                    <asp:Image ID="imgDateAsc" runat="server" ImageUrl="~/Styles/Images/sortUp.gif" />
                                    <asp:Image ID="imgDateDesc" runat="server" ImageUrl="~/Styles/Images/sortDown.gif" />
                                    &nbsp;
                                </div>
                                <asp:HiddenField ID="hfSort" runat="server" Value="date" />
                                <asp:HiddenField ID="hfAscDesc" runat="server" Value="desc" />
                            </td>
                            <tr>
                                <td class="sortByContainer" style="border-top: 0px" align="right">
                                </td>
                            </tr>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="style2" style="border-top: 0px" visible="False">
                    <asp:ListView ID="ListViewSearchResult" runat="server" DataSourceID="SqlDataSourceSearchResults"
                        DataKeyNames="outlet_ID">
                        <EmptyDataTemplate>
                            <span>No Search Results found.</span>
                        </EmptyDataTemplate>
                        <ItemTemplate>
                            <table border="0" width="600px">
                                <tr>
                                    <td height="35px" style="font-size: 1.5em; font-weight: bold ;border-top:0px">
                                        <asp:LinkButton ID="lbOutletName" CommandName="redirect" Text= '<%# string.concat( Eval("name")," - ",Eval("outletName") ) %>' runat="server" />
                                    </td>
                                    <td width="132px" style="border-top:0px">
                                        <asp:Label ID="priorityLabel" runat="server" Text='<%# Eval("priority") %>' Visible="false" />
                                        <asp:Label ID="lblsponsored" runat="server" class="label warning" Text="Sponsored"
                                            Visible="false"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="35px" colspan="2" style="border-top:0px">
                                        <asp:HyperLink ID="hlWebsite" runat="server" NavigateUrl='<%# Eval("website") %>'><%# Eval("website") %></asp:HyperLink>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="35px" colspan="2" style="border-top:0px">
                                        <asp:Label ID="detailsLabel" runat="server" Text='<%# Eval("details") %>' />
                                        <asp:Label ID="outlet_IDLabel" Visible="false" runat="server" Text='<%# Eval("outlet_ID") %>' />
                                        <asp:Label ID="categoryLabel" Visible="false" runat="server" Text='<%# Eval("category") %>' />
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                        <LayoutTemplate>
                            <div style="" id="itemPlaceholderContainer" runat="server">
                                <span runat="server" id="itemPlaceholder" />
                            </div>
                            <div style="">
                            </div>
                        </LayoutTemplate>
                    </asp:ListView>
                    <asp:SqlDataSource ID="SqlDataSourceSearchResults" runat="server" ConnectionString="<%$ ConnectionStrings:yijungoodAnotDBConnectionString %>"
                        SelectCommand="SELECT business.name, business.website, business.details, outlet.name AS outletName, outlet.outlet_ID, outlet.priority, business.category as category FROM business INNER JOIN outlet ON business.business_ID = outlet.business_ID WHERE (outlet.outlet_ID IN (SELECT outlet_1.outlet_ID FROM outlet AS outlet_1 INNER JOIN business AS business_1 ON outlet_1.business_ID = business_1.business_ID WHERE (business_1.name LIKE '%' + @search + '%') OR (outlet_1.name LIKE '%' + @search + '%'))) ORDER BY outlet.priority DESC, (CASE @ascdesc WHEN 'asc' THEN outlet.date_created END), (CASE @ascdesc WHEN 'desc' THEN outlet.date_created END) DESC">
                        <SelectParameters>
                            <asp:QueryStringParameter Name="search" QueryStringField="s" />
                            <asp:ControlParameter ControlID="hfAscDesc" DefaultValue="desc" Name="ascdesc" PropertyName="Value" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
                <td class="style4" style="border-top: 0px">
                    <table class="bordered-table" bgcolor="Silver">
                        <tr>
                            <td>
                                <div id="categorysearchheader" align="center">
                                    <h2>
                                        Category</h2>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td width="50%" style="border-top: 0px">
                                <div class="input select" style="margin-left: -4px; margin-right: 10px">
                                    <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="True">
                                        <asp:ListItem>Any Categories</asp:ListItem>
                                          <asp:ListItem>Retail</asp:ListItem>
                                                <asp:ListItem>Fashion &amp; Clothing</asp:ListItem>
                                                <asp:ListItem>Beauty &amp; Sports</asp:ListItem>
                                                <asp:ListItem>Home &amp; Electronics</asp:ListItem>
                                                <asp:ListItem>Books &amp; Music</asp:ListItem>
                                                <asp:ListItem>Entertainment</asp:ListItem>
                                                <asp:ListItem>Night Clubs</asp:ListItem>
                                                <asp:ListItem>Gaming </asp:ListItem>
                                                <asp:ListItem>Cinema</asp:ListItem>
                                                <asp:ListItem>Arts</asp:ListItem>
                                                <asp:ListItem>Museums</asp:ListItem>
                                                <asp:ListItem>Education</asp:ListItem>
                                                <asp:ListItem>Tuition Centre</asp:ListItem>
                                                <asp:ListItem>Enrichment Classes</asp:ListItem>
                                                <asp:ListItem>Health &amp; Beauty</asp:ListItem>
                                                <asp:ListItem>Doctors</asp:ListItem>
                                                <asp:ListItem>Dentists</asp:ListItem>
                                                <asp:ListItem>Clinics</asp:ListItem>
                                                <asp:ListItem>Medical Spa / Spa</asp:ListItem>
                                                <asp:ListItem>Massage</asp:ListItem>
                                                <asp:ListItem>Makeup Artist</asp:ListItem>
                                                <asp:ListItem>Pets</asp:ListItem>
                                                <asp:ListItem>Pet Accessories</asp:ListItem>
                                                <asp:ListItem>Veterinarians</asp:ListItem>
                                    </asp:DropDownList>
                                </div>
                            </td>
                        </tr>
                    </table>
                    <asp:HiddenField ID="hfCategory" runat="server" />
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
